<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/li/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改运营用户</title>
<script type="text/javascript">
 
sfAutoEmail.email({
	mailList:["@xiaoniu66.com"]
});

$(function(){
	
	
	$("#userForm").validator({validInHidden:true},{
		callback:function(results){
			$("#userForm").ajaxSubmit(function(data){
				 myDialog.close();
	        	 myDialog =  art.dialog({icon: data.success,content: data.message,lock:true});
	        	 $("#gridTable").trigger("reloadGrid", [{page:1}]); 
				});
		}
	});
	//选中岗位
	$("#duty").val('<c:out value="${duty}"/>');
});

function onModifyClick(e, treeId, treeNode) {
	nodes = zTree1.getSelectedNodes();
	$("#select2").html(nodes[0].orgName);
	$("#orgId").attr("value",nodes[0].id);
	$("#department").attr("value",nodes[0].orgCode);
	$("#orgName").attr("value",nodes[0].orgName);
	$("#department").blur();
	$("#orgtree2").hide();
}

</script>
</head>
<body>
			<form id="userForm" method="post" action="cms/operator/modify">
			<input id="id" name="id" type="hidden" value="<c:out value="${id}"/>"/>
				<ul class="all_list">
						<li>
							<span class="all_title">用户名：</span>
							<span><label name="userName"><c:out value="${userName}"/></label>
								<input id="userName" validator='{"label":"用户名"}' name="userName" type="hidden" value="<c:out value="${userName}"/>"/>
							</span>
						</li>
						<li>
							<span class="all_title">真实姓名：</span>
							<span><input id="realName" validator='{"label":"真实姓名","maxLength":30}' type="text" class="ui_input" value="<c:out value="${realName}"/>"
								name="realName">
							</span>
						</li>
						<li>
							<span class="all_title">联系电话：</span>
							<span><input id="telephone" validator='{"label":"联系电话","txtType":"phone","maxLength":15}' type="text" class="ui_input" value="<c:out value="${telephone}"/>"
								name="telephone">
							</span>
						</li>
						<li>
							<span class="all_title">邮箱：</span>
							<span><input id="email" type="text" validator='{"label":"邮箱","txtType":"xn-email","maxLength":50}'  class="ui_input fn-email" value="<c:out value="${email}"/>" name="email">
							</span>
							<br/><span class="all_title"></span>
						</li>
						<li>
							<span class="all_title">备注：</span>
							<span><textarea id="remark"  name="remark" style="width: 163px; height: 84px;" validator='{"label":"备注","required":false,"maxLength":500}'><c:out value="${remark}"/></textarea></span>
						</li>
						<li>
							<span class="all_title"></span>
							<span><shiro:hasPermission name="operator:modify"><input type="button" id="modifyButton" class="edit_btn  submitBtn"  name="modifyButton"  value="修改">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								</shiro:hasPermission><shiro:hasPermission name="operator:reset"><input id="password" type="button" class="btn_blue" value="重置密码" name="password" onclick="resetPwd()"></shiro:hasPermission>
							</span>
						</li>
						</ul>
			</form>
			<c:forEach var="role" items="${myRoleList}">
				<input name="myRoleList" type="hidden" value="<c:out value="${role.id}"/>" />
			</c:forEach>
<script type="text/javascript">
	
	function resetPwd(){
		var userName=$('#userName').attr("value");
		$.ajax({
			type : "POST",
			url : "<%=request.getContextPath()%>/cms/operator/reset_pwd/"+userName+"?rand="+Math.random(),
			data:'userName='+userName,
			success : function(data) {
			art.dialog({icon: data.success,content: data.message,lock:true});
			}
		});
	}
	
	function setAuthMethod(method){
		if(method=="0"){
			$('#cardIdbound').hide();
			$('#cardId').attr("value",1);
		}else if(method=="1"){
			$('#cardIdbound').show();
			if($('#cardId').attr("value")=="1"){
				$('#cardId').attr("value","");
			}
		}
	}
	
	/* $("#red_card").click(function(){
		$("#cardId1").focus();
	}); */
</script>
</body>
</html>